<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
    <head>
        <%@include file="../common/head.jspf" %>
    </head>

    <body class="fund-page sb-l-o sb-r-c" data-menu="#menu_coupon" data-list="#li_coupon">

        <!-- 主体内容开始 -->
        <div id="main">

            <!--侧边导航栏-->
            <%@include file="../common/sidebar.jspf" %>

            <!-- Start: Content-Wrapper -->
            <section id="content_wrapper">

                <!-- 顶部导航 -->
                <header id="topbar">
                    <div class="topbar-left">
                        <ol class="breadcrumb">
                            <li class="crumb-active">
                                <span>软擎科技</span>
                            </li>
                            <li class="crumb-icon">
                                <a href="dashboard"><span class="glyphicon glyphicon-home"></span></a>
                            </li>
                            <!-- 当前页 -->
                            <li class="crumb-trail">红包管理</li>
                        </ol>
                    </div>
                    <div class="topbar-right">
                        <!-- 登录信息 -->
                        <%@include file="../common/session.jspf" %>
                    </div>
                </header>
                <!-- 顶部导航结束 -->

                <!-- 页面内容开始 -->
                <section id="content">
                    <div class="btn-group ib mr10">
                        <a href="coupon/list" class="btn btn-primary light">红包管理</a>
                        <!--<a href="javascript:;" class="btn btn-default light">红包兑现</a>-->
                    </div>
                    <gg:permission permissions="COUPON_ADMIN">
                        <a href="coupon/add" class="btn btn-system light pull-right"><span class="glyphicons glyphicons-magic mr10"></span>创建红包</a>
                    </gg:permission>

                    <hr class="br-light mt10 mb10">

                    <!--投标记录-->
                    <div class="panel-body pn bg-white">
                        <table class="table table-striped table-hover table-text-center" id="couponList" cellspacing="0" width="100%">
                            <thead>
                                <tr>
                                    <th></th>
                                    <th>红包名称</th>
                                    <th>红包类型</th>
                                    <th>红包金额</th>
                                    <th>最小投标额</th>
                                    <th>创建人</th>
                                    <th>发放开始日期</th>
                                    <th>发放截止时间</th>
                                    <th>红包过期天数</th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody id="tbody"></tbody>
                        </table>
                    </div>
                </section>
                <!-- 页面内容结束 -->

            </section>
        </div>

        <%@include file="../loan/modal/processing.jspf" %>

        <!--操作菜单模板-->
        <div id="operationHTML" class="hidden">
            <div class="btn-group">
                <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="true"><i class="glyphicon glyphicon-wrench mr5"></i>操作
                    <span class="caret ml5"></span>
                </button>
                <ul class="dropdown-menu pull-right" role="menu">
                    <li class="editLink">
                        <a href="coupon/edit/#id"><span class="glyphicons glyphicons-edit mr5"></span>红包编辑</a>
                    </li>
                    <li class="downloadLink">
                        <a href="coupon/downloadCouponDetail/#id"><span class="glyphicons glyphicons-download_alt mr5"></span>下载详情</a>
                    </li>
                </ul>
            </div>
        </div>

        <script type="text/x-tmpl-mustache" id="couponPlacementTemplate">
            <table class="table table-striped table-text-center">
            <thead>
            <tr>
            <th>用户名</th>
            <th>手机号</th>
            <th>注册时间</th>
            <th>三方账号</th>
            <th>投资金额</th>
            <th>红包状态</th>
            <th>兑现</th>
            </tr>
            </thead>
            <tbody>
            {{#placements}}
            <tr class="message-read">
            <td><a href="user/index/{{user.id}}" target="_blank">{{user.loginName}}</a></td>
            <td>{{user.mobile}}</td>
            <td>{{registerDate}}</td>
            <td>{{account}}</td>
            <td>{{userInvestAmount}}</td>
            <td data-st='{{ticket.id}}'>{{{status}}}</td>
            <td data-cz='{{ticket.id}}'>
                <div class="btn-group mr10">
                    <gg:permission permissions="COUPON_PAY">
                        {{#active}}
                            <button class="btn btn-system btn-xs pay-link" data-pid="{{id}}" data-tid="{{ticket.id}}" data-uid="{{user.id}}" data-amount="{{bonus}}">打款</button>
                        {{/active}}
                    </gg:permission>
                    <gg:permission permissions="COUPON_REJECT">
                        {{#cancel}}
                            <button class="btn btn-default light btn-xs text-muted reject-link" data-tid="{{ticket.id}}">作废</button>
                        {{/cancel}}
                    </gg:permission>
                </div>
            </td>
            </tr>
            {{/placements}}
            </tbody>
            </table>
        </script>
        <script type="text/x-tmpl-mustache" id="userInvestCycleTemplate">
            <table class="table table-striped table-text-center">
                <thead>
                    <tr>
                        <th>用户名</th>                                   
                        <th>金额</th>			
                        <th>投资记录</th>
                        <th>红包状态</th>
                        <th>兑现</th>
                    </tr>
                </thead>
                <tbody>
                    {{#placements}}
                    <tr class="message-read">
                        <td><a href="user/index/{{user.id}}" target="_blank">{{user.loginName}}</a></td>			
			<td>{{ticket.actualBonus}}</td>
                        <td><a href="/Admin/coupon/treeDetailList/{{ticket.id}}" target="_blank">投资记录</a></td>                        
                        <td data-st='{{ticket.id}}'>{{{status}}}</td>
                        <td data-cz='{{ticket.id}}'>
                             <div class="btn-group mr10">
                                 
                                    {{#active}}
                                        <button class="btn btn-system btn-xs pay-link" data-pid="{{id}}" data-tid="{{ticket.id}}" data-uid="{{user.id}}" data-amount="{{ticket.actualBonus}}">打款</button>
                                    {{/active}}
                                
                                
                                    {{#cancel}}
                                        <button class="btn btn-default light btn-xs text-muted reject-link" data-tid="{{ticket.id}}">作废</button>
                                    {{/cancel}}
                                
                            </div>
                        </td>
                    </tr>
                    {{/placements}}
                </tbody>
            </table>
        </script>
        <script type="text/x-tmpl-mustache" id="refereeCouponTemplate">
            <table class="table table-striped table-text-center">
                <thead>
                    <tr>
                        <th>用户名</th>
                        <th>好友登录名</th>
                        <th>好友手机号</th>
                        <th>好友注册时间</th>
                        <th>三方账号</th>
                        <th>好友投资金额</th>
                        <th>红包状态</th>
                        <th>兑现</th>
                    </tr>
                </thead>
                <tbody>
                    {{#placements}}
                    <tr class="message-read">
                        <td><a href="user/index/{{user.id}}" target="_blank">{{user.loginName}}</a></td>
                        <td><a href="user/index/{{friend.id}}" target="_blank">{{friend.loginName}}</a></td>
                        <td>{{friend.mobile}}</td>
                        <td>{{registerDate}}</td>
                        <td>{{account}}</td>
                        <td>{{userInvestAmount}}</td>
                        <td data-st='{{ticket.id}}'>{{{status}}}</td>
                        <td data-cz='{{ticket.id}}'>
                             <div class="btn-group mr10">
                                 <gg:permission permissions="COUPON_PAY">
                                    {{#active}}
                                        <button class="btn btn-system btn-xs pay-link" data-pid="{{id}}" data-tid="{{ticket.id}}" data-uid="{{user.id}}" data-amount="{{bonus}}">打款</button>
                                    {{/active}}
                                </gg:permission>
                                <gg:permission permissions="COUPON_REJECT">
                                    {{#cancel}}
                                        <button class="btn btn-default light btn-xs text-muted reject-link" data-tid="{{ticket.id}}">作废</button>
                                    {{/cancel}}
                                </gg:permission>
                            </div>
                        </td>
                    </tr>
                    {{/placements}}
                </tbody>
            </table>
        </script>
        <script type="text/x-tmpl-mustache" id="exchangeTicketTemplate">
			<table class="table table-striped table-text-center">
			<thead>
			<tr>
			<th>用户名</th>
			<th>手机号</th>
			<th>注册时间</th>
			<th>三方账号</th>
			<th>红包金额</th>
			<th>红包状态</th>
			<th>兑现</th>
			</tr>
			</thead>
			<tbody>			   

                        {{#placements}}
			<tr class="message-read">
			<td><a href="user/index/{{user.id}}" target="_blank">{{user.loginName}}</a></td>
			<td>{{user.mobile}}</td>
			<td>{{registerDate}}</td>
			<td>{{account}}</td>
			<td>{{ticket.actualBonus}}</td>
			<td data-st='{{ticket.id}}'>{{{status}}}</td>
			<td data-cz='{{ticket.id}}'>
				<div class="btn-group mr10">
					
						{{#active}}
							<button class="btn btn-system btn-xs pay-link" data-pid="{{id}}" data-tid="{{ticket.id}}" data-uid="{{user.id}}" data-amount="{{ticket.actualBonus}}">打款</button>
						{{/active}}
					
					
						{{#cancel}}
							<button class="btn btn-default light btn-xs text-muted reject-link" data-tid="{{ticket.id}}">作废</button>
						{{/cancel}}
					
				</div>
			</td>
			</tr>
			{{/placements}}
			</tbody>
			</table>
        </script>
        <script type="text/x-tmpl-mustache" id="investCouponTemplate">
            <table class="table table-striped table-text-center">
            <thead>
            <tr>
            <th>用户名</th>
            <th>手机号</th>
            <th>注册时间</th>
            <th>三方账号</th>
            <th>投资金额</th>
            <th>红包状态</th>
            <th>兑现</th>
            </tr>
            </thead>
            <tbody>
            {{#placements}}
            <tr class="message-read">
            <td><a href="user/index/{{user.id}}" target="_blank">{{user.loginName}}</a></td>
            <td>{{user.mobile}}</td>
            <td>{{registerDate}}</td>
            <td>{{account}}</td>
            <td>{{userInvestAmount}}</td>
            <td data-st='{{ticket.id}}'>{{{status}}}</td>
            <td data-cz='{{ticket.id}}'>
                <div class="btn-group mr10">
                    <gg:permission permissions="COUPON_PAY">
                        {{#active}}
                            <button class="btn btn-system btn-xs pay-link" data-pid="{{id}}" data-tid="{{ticket.id}}" data-uid="{{user.id}}" data-amount="{{bonus}}">打款</button>
                        {{/active}}
                    </gg:permission>
                    <gg:permission permissions="COUPON_REJECT">
                        {{#cancel}}
                            <button class="btn btn-default light btn-xs text-muted reject-link" data-tid="{{ticket.id}}">作废</button>
                        {{/cancel}}
                    </gg:permission>
                </div>
            </td>
            </tr>
            {{/placements}}
            </tbody>
            </table>
        </script>
        <%@include file="../common/scripts.jspf" %>
        <script src="${rootPath}/js/admin-tools/admin-forms/js/jquery-ui-timepicker.min.js"></script>
        <script src="${rootPath}/js/admin-tools/admin-forms/js/lang/jquery-ui-timepicker-zh.js"></script>
        <script type="text/javascript" src="${rootPath}/js/pages/coupon/list.js"></script>
    </body>
</html>
